package xin.marcher.module.construction.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import xin.marcher.module.common.core.PageResult;
import xin.marcher.module.construction.domain.dto.AuditInfoDTO;
import xin.marcher.module.construction.domain.dto.AuditorListConfigDTO;
import xin.marcher.module.construction.domain.dto.DraftImgDTO;
import xin.marcher.module.construction.domain.dto.DraftMainDTO;
import xin.marcher.module.construction.domain.entity.*;
import xin.marcher.module.construction.domain.request.AuditRequest;
import xin.marcher.module.construction.domain.request.AuditorListConfigRequest;

import java.util.List;

/**
 * 审核相关对象克隆
 *
 *
 */
@Mapper(componentModel = "spring")
public interface AuditConverter {


    /**
     * 对象克隆
     *
     * @param auditInfoDOPage
     * @return
     */
    PageResult<AuditInfoDTO> converterPageResult(Page<AuditInfoDO> auditInfoDOPage);

    /**
     * 对象克隆
     *
     * @param draftMainDO
     * @return
     */
    AuditInfoDO converterDO(DraftMainDO draftMainDO);

    /**
     * 对象克隆
     *
     * @param auditInfoDO
     * @return
     */
    @Mapping(target = "ticketId", source = "id")
    AuditHistoryDO converterHistoryDO(AuditInfoDO auditInfoDO);

    /**
     * 对象克隆
     *
     * @param auditRequest
     * @return
     */
    @Mappings({
            @Mapping(target = "updateUser", source = "operatorUser"),
            @Mapping(target = "auditReason", source = "rejectReason"),
            @Mapping(target = "ticketStatus", source = "auditStatus"),
    })
    AuditHistoryDO converterHistoryDO(AuditRequest auditRequest);

    /**
     * 对象克隆
     *
     * @param draftMainDO
     * @return
     */
    DraftMainDTO convertDTO(DraftMainDO draftMainDO);

    /**
     * 集合对象克隆
     *
     * @param list
     * @return
     */
    List<DraftImgDTO> convertImgDTO(List<DraftImgDO> list);

    /**
     * 对象克隆
     *
     * @param auditInfoDO
     * @return
     */
    @Mapping(target = "draftMainDTO", ignore = true)
    AuditInfoDTO convertAuditDTO(AuditInfoDO auditInfoDO);

    /**
     * 对象克隆
     *
     * @param draftMainDTO
     * @return
     */
    DraftMainDO converterDO(DraftMainDTO draftMainDTO);

    /**
     * 对象克隆
     *
     * @param draftMainDTO
     * @return
     */
    AuditInfoDO convertAuditDO(AuditInfoDTO auditInfoDTO);

    /**
     * 对象克隆
     *
     * @param request
     * @return
     */
    AuditorListConfigDO requestToEntity(AuditorListConfigRequest request);

    /**
     * 对象克隆
     *
     * @param stageList
     * @return
     */
    List<AuditorListConfigDTO> listEntityToDTO(List<AuditorListConfigDO> stageList);
}
